package com.campus.help.common;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 劳务状态枚举
 *
 * @author campus-help
 * @since 2025-09-18
 */
@Getter
@AllArgsConstructor
public enum LaborStatus {

    /**
     * 招聘中
     */
    RECRUITING("recruiting", "招聘中"),

    /**
     * 已关闭
     */
    CLOSED("closed", "已关闭"),

    /**
     * 已完成
     */
    COMPLETED("completed", "已完成");

    /**
     * 状态码
     */
    private final String code;

    /**
     * 状态描述
     */
    private final String description;

    /**
     * 根据状态码获取枚举
     */
    public static LaborStatus fromCode(String code) {
        for (LaborStatus status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown labor status code: " + code);
    }
}
